<!--
<div id="bgPopup" style="opacity: 0.7; display: block;"></div>
-->
<div id="formdangky"></div><!--End #formdangky-->


<!--
    <a class="popup" href="http://localhost/hoidap/Source/likes/index/getuserlikesbypost?post=1234">like</a> 
-->
	<?php $iduser =1;?>
	<input type="hidden" id="input_iduser" name="iduser" value="<?php echo $iduser;?>"/>
	<div id="" class="wrapper">
		<div id="leftContent" class="floatLeft">

			<!-- <div id="" class="box">
				<h1 id="sht" class="ansq">Yeu thich<a href="#" title="" class="floatRight">Ẩn/Hiện</a></h1>

				<ul id="listOfQ" class="userLi">
					<li><img src="images/Imess.png" alt=""><a href="" title="">Tin nhan</a></li>
					<li><a href="" title="">Bang tin </a><span>34</span></li>
					<li><a href="" title="">Cau hoi</a></li>
					<li><a href="" title="">Ban be</a></li>
					<li><a href="" title="">Hoi nhom </a></li>
				</ul><!-- / LIST QUESTION
			</div><!-- / BOX -->
			
			<div class="box_user">
				<div class="userImageSmall"><img src="image/1.jpg"></div>
				<div class="mg_top_50">
					<ul>
						<li> <span class="text1">YÊU THÍCH</span>
							<ul class="mg-l10">
								<li class="text2"> <a href="#">Bảng tin</a></li>
								<li class="text2"> <a href="#">Tin nhắn</a></li>
								<li class="text2"> <a href="#">Câu hỏi của bạn</a></li>
								<li class="text2"> <a href="#">Tìm kiếm bạn bè</a></li>
							</ul>
						</li>
						<div class="bd_b1">&nbsp;</div>
						<li> <span class="text1">DANH SÁCH</span>
							<ul class="mg-l10">
								<li class="text2"> <a href="#">Gia đình</a></li>
								<li class="text2"> <a href="#">Bạn bè</a></li>
								<li class="text2"> <a href="#">Người thân</a></li>
								<li class="text2"> <a href="#">Người quen</a></li>
								<li class="text2"> <a href="#">Đang theo dõi</a></li>
								<li class="text2"> <a href="#">Được theo dõi</a></li>
							</ul>
						</li>
						<div class="bd_b1">&nbsp;</div>
						<li> <span class="text1">NHÓM</span>
							<ul class="mg-l10">
								<li class="text2"> <a href="#">Tạo nhóm</a></li>
							</ul>
						</li>
						

					</ul>
				</div>
			</div>
			
		</div><!-- / LEFT CONTENT-->
		<div id="container">
		<div id="centerContent" class="floatLeft">
		
<!--
			<div id="" class="box">
				<ul id="" class="Seditor">
					<li><img src="images/writeQ.jpg" alt=""><a href="" title="">Viet cau hoi</a></li>
					<li><img src="images/writeS.jpg" alt=""><a href="#" title="">Cap nhat trang thai</a></li>
					<div id="" class="clear"></div>
				</ul>
				<div id="" class="LEditor">
					<div id="" class="topEdit2"></div>
					<textarea class="my val_textarea_status" type="text" placeholder="Bạn đang nghĩ gì?" 
						rows=1 style="height:auto" id="post_new_status" 
						onfocus="show_text_area_status({idn:this.id,classShow:'postsbottom'})" 
						onkeyup="auto_grow_area3(this.id)"></textarea>
			<div class="postsbottom" style="display:none">					
				
					<div id="" class="opEditor">
					<select  id="categories_cha" name="categories_cha" onchange="return catelogy_select_text({id:'select_cat_parent' , parent:this.value})" >
						<option value="0">Chọn loại câu hỏi</option>
						<?php
						$Listscate = $this->Listscate;
						foreach ($Listscate AS $cate)
						{						
							echo "<option value='$cate[ID]'>$cate[category_name]</option>";
						}
						?>
						<option value="-1">Xem tất cả</option>
					</select>
						
					<span id="select_cat_parent">
						<select   id="categories_con" name="categories_con">
						<option value="0">Chọn Danh mục câu hỏi</option>
						</select>
					</span>
								
					
					</div>
					
						
					<input type="submit" value="Chia sẽ" class="buttonStatus"
						onclick="return waiting_load_status_and_question({noidung:'val_textarea_status', 
								catcha:'categories_cha', catcon:'categories_con'})" />		
			</div>
				</div>
			</div>
-->


			<div id="" class="box">
				<ul id="" class="Seditor">
					<li class="vietcauhoi"><img src="<?php echo $this->baseUrl('public/images/writeq.jpg')?>" alt=""><a href="javascript:;" title="">Viet cau hoi</a></li>
					<li class="themhinhanh"><img src="<?php echo $this->baseUrl('public/images/writei.jpg')?>" alt=""><a href="javascript:;" title="">Them hinh anh</a></li>
					<li class="capnhattrangthai"><img src="<?php echo $this->baseUrl('public/images/writes.jpg')?>" alt=""><a href="javascript:;" title="">Cap nhat trang thai</a></li>
					<div id="" class="clear"></div>
				</ul>
				<div id="" class="post">
					<div class="dieuhuong"></div>
					
					<div class="top_post post_cauhoi">
						<form>
						<!--
						<div class="testabc">
						
						<a href="abcde333">
						abcd
						</a>
						</div>
						
						<!--
						<div id="testab"><img src="http://media.vatgia.vn/thumb140/11/small_vwx1271149130.jpg" id="mmnnbb" class="afterImage img_status_posted_edit" style="padding: 0px; display: block;">
									</div>
						-->
						<!--
						<textarea class="input_nd_ch val_textarea_status" type="text" name="nd_cauhoi"></textarea>
						-->
						
						<textarea name="nd_cauhoi" class="input_nd_ch val_textarea_status" type="text" placeholder="Bạn muốn hỏi gì...?" 
						rows=1 style="height:auto" id="post_new_status" 
						onfocus="show_text_area_status({idn:this.id,classShow:'postsbottom'})" 
						onkeyup="auto_grow_area3(this.id)"></textarea>
					
										
						
						
						
						
						<div class="postsbottom" style="display:none">
									
									<div class="after_att panel_posted_status_edit_img" style="display:none;">
									<div class="img_link_post"><img class="afterImage img_status_posted_edit" id="use_image_status" src="<?php echo $this->baseUrl('public/images/loading.gif')?>" />
									</div>
									<div class="noidung_link_post" id="">
									<div class="mg_top_5"><span href=# class="title_post_link title_post_status_edit" onclick="click_edit_({text:this.innerHTML,cln:'title_post_status_edit',inp:'input',w:document.getElementById('id_width').offsetWidth});"></span></div>
									<div><a id="meta_link" class="link_post_link link_posted_status"></a></div>
									<span id="meta_content" class="content_post_link noidung_post_status_edit" onclick="click_edit_({text:this.innerHTML,cln:'noidung_post_status_edit',w:document.getElementById('id_width').offsetWidth ,h:document.getElementById('id_width').offsetHeight});"></span>

									<div class="select_image_link_status none_display">
									<p class="btn_next_prev">
									<img class="nextPrev prev_img_status" src="<?php echo $this->baseUrl('public/images/prev_status.png')?>">
									<img class="nextPrev next_img_status" src="<?php echo $this->baseUrl('public/images/next_status.png')?>">
									<span class="text_1">Chọn một hình</span>
									</p>
									</div><br><br>
									<div class="khongdunghinh">
									<input type="checkbox" name="s" class="lfloat" id="checkStatusImage" onchange="(document.getElementById('use_image_status').style.display=='none') ? 
									document.getElementById('use_image_status').style.display='block' : document.getElementById('use_image_status').style.display='none';">
									<label class="lfloat mg_left_10 c44 bold" for="checkStatusImage">Không dùng hình.</label>
									</div>
									</div>
									</div>
									
									
									
									
							<div class="boundLinkStatus">
							<input type="text" class="input " placeholder="http://" onkeyup="return waiting_getlink_status(this.value);">
							</div>
						</div>
						<div class="control_post">
							<ul>
								<li class="hinhanh_post"></li>
								<li class="link_post"></li>
								<li class="">
									<select  id="categories_cha" name="categories_cha" onchange="return catelogy_select_text({id:'select_cat_parent' , parent:this.value})" >
										<option value="0">Chọn loại câu hỏi</option>
										<?php
										$Listscate = $this->Listscate;
										foreach ($Listscate AS $cate)
										{						
											echo "<option value='$cate[ID]'>$cate[category_name]</option>";
										}
										?>
										<option value="-1">Xem tất cả</option>
									</select>
						
									<span id="select_cat_parent">
										<select   id="categories_con" name="categories_con">
										<option value="0">Chọn Danh mục câu hỏi</option>
										</select>
									</span>
								</li>
								<!--
								<li class="">
									<select id="active" name="categories_cha">
										<option value="">option 1</option>
										<option value="">option 1</option>
										<option value="">option 1</option>
										<option value="">option 1</option>
										<option value="">option 1</option>
									</select>
								</li>
								-->
								<li class="btn_post_nd" onclick="return waiting_load_status_and_question({noidung:'val_textarea_status', 
								catcha:'categories_cha', catcon:'categories_con'})"  >Đăng câu hỏi</li>
							</ul>
						</div>
						</form>
					</div><!--End .post_cauhoi-->
					<div class="top_post post_hinhanh">
						<form method="post" enctype="multipart/form-data"  action="upload.php">
						<textarea class="input_nd_ha" type="text" name="nd_hinhanh"></textarea>
						<div class="ct_post_ha">
							<p>Chọn một tập tin hình ảnh từ máy của bạn</p>
							<input  class="btn_abc" type="button" name="btn_abc"/>
							<input type="file" name="images" id="images" multiple />
							<p class="loading_img"><img src="<?php echo $this->baseUrl('public/images/loading.gif')?>"/></p>
							<ul class="image_list"></ul>
							<script src="<?php echo $this->baseUrl('public/js/upload.js')?>" type="text/javascript"></script>
							
							
							
						</div>
						<div class="control_post">
							<ul>
								<li class="btn_post_nd">Đăng hình ảnh</li>
							</ul>
						</div>
						</form>
					</div><!--End .post_hinhanh-->
					<div class="top_post post_trangthai">
					<form>
						<textarea class="input_nd_th" type="text" name="nd_trangthai"></textarea>
						<div class="input_link_post">
							<input type="text" name="input_link_post" placeholder="http://"/>
						</div>
						<div class="control_post">
							<ul>
								<li class="hinhanh_post"></li>
								<li class="link_post"></li>
								<li class="btn_post_nd">Đăng trạng thái</li>
							</ul>
						</div>
					</form>	
					</div><!--End .post_trangthai-->
					<script type="text/javascript">
					$('.post_hinhanh').hide();
					$('.post_trangthai').hide();
					$('.input_link_post').hide();
					$('.boundLinkStatus').hide();
					
					$(document).ready(function(){
						$('.vietcauhoi').click(function(){
							$('.post_cauhoi').show();
							$('.post_hinhanh').hide();
							$('.post_trangthai').hide();
							$('.dieuhuong').css("margin-left","40px");
						});
						$('.themhinhanh').click(function(){
							$('.post_cauhoi').hide();
							$('.post_hinhanh').show();
							$('.post_trangthai').hide();
							$('.dieuhuong').css("margin-left","200px");
						});
						$('.capnhattrangthai').click(function(){
							$('.post_cauhoi').hide();
							$('.post_hinhanh').hide();
							$('.post_trangthai').show();
							$('.dieuhuong').css("margin-left","380px");
						});
						
						$('.link_post').click(function(){
							$('.input_link_post').slideToggle();
							$('.boundLinkStatus').slideToggle('fast');
						});
					});
					</script>
				</div><!-- / -->	
			</div><!-- / BOX-->


			<div id="" class="box">
				
				
					<div id="new_post" ></div>

				<?php
				
				
				$detais = $this->post['row'];
				$thaoluan = $this->post['rowparent'];
				$userlike = $this->post['userlike'];

				
				foreach ($detais AS $k => $detai)
				{
				$songuoilike = count($userlike[$k]);
				
				?>
						
						
				<div id="" class="listPost">
					<img src="images/ava.jpg" alt="">
					<h1><a href="" title="">le huy truyen</a> - <?php echo $detai['p_datetime']; ?></h1>
					<p>
						<?php echo $detai['post_content']; ?>
					</p>

					<div id="" class="onComment">
						<a href="javascript:none" onclick="document.getElementById('comment_<?php echo  $detai['ID']; ?>').style.display='inline-block';document.getElementById('<?php echo  $detai['ID']; ?>').focus();return false;">Bình luận</a>

					<span id="like_1_<?php echo  $detai['ID']; ?>" >
						<a href="javascript:none"  onclick="return ajlikes('1','<?php echo $detai['ID']?>',<?php echo $iduser ?>,'<?php echo $detai['like_status']?>','<?php echo $songuoilike ?>')" title=""><?php echo $detai['like']?></a>
					</span>
					
					<?php
					if($songuoilike >= 1)
						{			
							$ds_userlike = '';
							foreach($userlike[$k] AS $userlikes)
							{
							$ds_userlike .= $userlikes['user_name'];
							$ds_userlike .= " ,";
							}
							//echo $ds_userlike ;
							
						}
					?>
				<?php
				if($detai['like_status'] != NULL )
				{
					echo "<span id='youlike1$detai[ID]'>Bạn</span>";
				}
				else
				{
					echo "<span id='youlike1$detai[ID]'></span>";
				}
				?>
				
					
				<?php
				
				
				if($songuoilike != 0 && $detai['like_status'] != NULL)
				{
					echo "<span id='youlikeand1$detai[ID]'> và </span>";
				}
				else
				{
					echo "<span id='youlikeand1$detai[ID]'></span>";
				}
				
				if($songuoilike != 0 )
				{				
				
					// echo "<a onclick=\"return alert('$ds_userlike')\">".$songuoilike." Người khác </a>";
					echo "<a onclick=\"return like_popup({id:'$detai[ID]', type:'1'})\">".$songuoilike." Người khác </a>";
				}
				
				if($songuoilike != 0 || $detai['like_status'] != NULL)
				{
					echo "<span id='thichdieunay1$detai[ID]'>thích điều này.</span>";				
				}
				else
				{
					echo "<span id='thichdieunay1$detai[ID]'></span>";		
				}
					
						
						foreach ($thaoluan[$k] as $tl )
						{						
						
						
						$songuoilikecomment = count($tl['userlike']);
						
						if($songuoilikecomment >= 1)
						{				
							$ds_userlike = '';
							foreach($tl['userlike'] AS $userlikes)
							{
							$ds_userlike .= $userlikes['user_name'];
							$ds_userlike .= " ,";
							}
						//	echo $ds_userlike ;
						
						}					
						
				?>

							
						
						<div id="" class="replyList">
							<img src="images/ava.jpg" alt="">
							<h1>
								<a href="" title=""><?php echo $tl['user_name']; ?></a> - <?php echo $tl['c_datetime']; ?> ' 
									
								<span id="like_2_<?php echo  $tl['ID']; ?>" >
									<a href="javascript:none"  onclick="return ajlikes('2','<?php echo $tl['ID']?>',<?php echo $iduser ?>,'<?php echo $tl['like_status']?>','<?php echo $songuoilikecomment ?>')" title=""><?php echo $tl['like']; ?></a>
								</span>
							
			
				<?php
				if($tl['like_status'] != NULL )
				{
					echo "<span id='youlike2$tl[ID]'>Bạn</span>";
				}
				else
				{
					echo "<span id='youlike2$tl[ID]'></span>";
				}
				?>
				
					
				<?php
				
				
				if($songuoilikecomment != 0 && $tl['like_status'] != NULL)
				{
					echo "<span id='youlikeand2$tl[ID]'> và </span>";
				}
				else
				{
					echo "<span id='youlikeand2$tl[ID]'></span>";
				}
				
				if($songuoilikecomment != 0 )
				{	
				//	echo " <a class=\"popup\" href=\"http://localhost/hoidap/Source/likes/index/getuserlikesbypost?post=$tl[ID]\">".$songuoilikecomment." Người khác </a>";
				//	echo "<a onclick=\"return alert('$ds_userlike')\">".$songuoilikecomment." Người khác </a>";
					echo "<a onclick=\"return like_popup({id:'$tl[ID]', type:'2'})\">".$songuoilikecomment." Người khác </a>";
				
				}
				
				if($songuoilikecomment != 0 || $tl['like_status'] != NULL)
				{
					echo "<span id='thichdieunay2$tl[ID]'>thích điều này.</span>";				
				}
				else
				{
					echo "<span id='thichdieunay2$tl[ID]'></span>";		
				}
				?>
		
							
							
							</h1>
					
						
				
					
							<p>
								<?php echo $tl['comment_content']; ?>
							</p>
							<p class="clear"></p>
						</div><!-- / -->
						
					
					
						
				<?php
						}					
				?>
				<div id="new<?php echo $detai['ID']?>" ></div>
				<div id="comment_<?php echo $detai['ID']?>" >
				<?php
				// TODO: lay userid tu sestion
				$userid =5;
				?>
				<textarea class="binhluanArea" style="width: 437px; height: 17px; resize: none;" id="<?php echo $detai['ID']?>" onfocus="return add_comment_text({id:'<?php echo  $detai['ID'] ?>', author:'<?php echo  $userid ?>'})"  placeholder="Viết bình luận..."  autocomplete="off" ></textarea>
				</div>
				<!--
				<textarea></textarea>
				-->
					</div><!-- / -->
					<div id="" class="clear"></div><!-- / -->
				</div><!-- / -->
						
				<?php
}
?>				
						
				
		

		
			</div><!-- / -->

		</div><!-- / CENTER CONTENT-->

		<div id="rightContent" class="floatRight">
			<div id="" class="quickPost">
				<ul id="" class="">
					<li class="quickMenu"><a href="" title="">Quick menu</a></li>
					<li class="addNews"><a href="" title="">Đăng tin</a></li>
				</ul><!-- / -->
				<ul id="" class="menuLeft">
					<li><a href="" title="">Thời trang</a>

						<div id="" class="subMenuFirst">
							<ul id="" class="">
								<li><a href="" title="">Title 1</a></li>
								<li><a href="" title="">Title 2</a></li>
								<li><a href="" title="">Title 3</a></li>
								<li><a href="" title="">Title 4</a></li>
							</ul><!-- / -->
						</div><!-- / Sub menu-->

					</li>
					<li><a href="" title="">Mỹ phẩm</a>

						<div id="" class="subMenuFirst">
							<ul id="" class="">
								<li><a href="" title="">Title 1</a></li>
								<li><a href="" title="">Title 2</a></li>
								<li><a href="" title="">Title 3</a></li>
								<li><a href="" title="">Title 4</a></li>
							</ul><!-- / -->
						</div><!-- / Sub menu-->

					</li>
					<li><a href="" title="">Điện máy</a></li>
					<li><a href="" title="">Máy tính-laptop</a></li>
					<li><a href="" title="">Việc làm</a></li>
					<li><a href="" title="">Kiến thức</a></li>
					<li><a href="" title="">Luật</a></li>
					<li><a href="" title="">Sức khỏe</a></li>
					<li><a href="" title="">Du lịch</a></li>
					<li><a href="" title="">Dịch vụ</a></li>
					<li><a href="" title="">Giải trí</a></li>
					<li><a href="" title="">Nội ngoại thất</a></li>
					<li><a href="" title="">Công nghiệp xây dựng</a></li>
				</ul><!-- / UL MENU-->
				<div class="clear"></div>
			</div><!-- / QUICK POST-->

			<div id="" class="box">
				<h1 class="adsT">Quảng cáo <a href="" class="floatRight" title="">Đặt quảng cáo</a></h1>
				
				<div id="" class="adsList">
					<h1><a href="" title="">Van Nguyen added a new photo</a></h1>
					<a href="" title=""><img src="http://kenh14.vcmedia.vn/zoom/120_75/zlA5ccccccccccccRby50VYME6hBz/Image/2012/04/120226starcllanh77703fAV_b7ff7.jpg" class="floatLeft" alt=""></a>
					<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
					<h2>Dang boi: <a href="" title="">Minh Man</a></h2>
				</div><!-- / ADS LIST-->
				<div id="" class="adsList">
					<h1><a href="" title="">Van Nguyen added a new photo</a></h1>
					<a href="" title=""><img src="http://kenh14.vcmedia.vn/zoom/120_75/zlA5ccccccccccccRby50VYME6hBz/Image/2012/04/120226starcllanh77703fAV_b7ff7.jpg" class="floatLeft" alt=""></a>
					<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
					<h2>Dang boi: <a href="" title="">Minh Man</a></h2>
				</div><!-- / ADS LIST-->
				
			</div><!-- / -->

			<div id="" class="box">
				<h1 class="adsT">Co the ban quen <a href="#" class="floatRight" title="">Xem tat ca</a></h1>

				<div id="" class="friend">
					<img src="images/ava.jpg" alt="">
					<h1>Your friend name</h1>
					<h2>10 ban chung</h2>
					<h3><img src="images/addF.jpg" alt=""><a href="javascript:;" onclick="addfriend('1',<?php echo $iduser;?>)">Them ban</a></h3>
				</div><!-- / -->
				<div id="" class="friend">
					<img src="images/ava.jpg" alt="">
					<h1>Your friend name</h1>
					<h2>10 ban chung</h2>
					<h3><img src="images/addF.jpg" alt=""><a href="javascript:;" onclick="addfriend('2',<?php echo $iduser;?>)">Them ban</a></h3>
				</div><!-- / -->
				<div id="" class="friend">
					<img src="images/ava.jpg" alt="">
					<h1>Your friend name</h1>
					<h2>10 ban chung</h2>
					<h3><img src="images/addF.jpg" alt=""><a href="javascript:;" onclick="addfriend('3',<?php echo $iduser;?>)">Them ban</a></h3>
				</div><!-- / -->
				<div id="" class="friend">
					<img src="images/ava.jpg" alt="">
					<h1>Your friend name</h1>
					<h2>10 ban chung</h2>
					<h3><img src="images/addF.jpg" alt=""><a href="javascript:;" onclick="addfriend('4',<?php echo $iduser;?>)">Them ban</a></h3>
				</div><!-- / -->
				<div id="" class="friend">
					<img src="images/ava.jpg" alt="">
					<h1>Your friend name</h1>
					<h2>10 ban chung</h2>
					<h3><img src="images/addF.jpg" alt=""><a href="javascript:;" onclick="addfriend('5',<?php echo $iduser;?>)">Them ban</a></h3>
				</div><!-- / -->
				<div id="" class="friend">
					<img src="images/ava.jpg" alt="">
					<h1>Your friend name</h1>
					<h2>10 ban chung</h2>
					<h3><img src="images/addF.jpg" alt=""><a href="javascript:;" onclick="addfriend('6',<?php echo $iduser;?>)">Them ban</a></h3>
				</div><!-- / -->
			</div><!-- / -->
		</div><!-- / RIGHT CONTENT-->
		</div>
		<div id="" class="clear"></div><!-- / -->
	</div><!-- / -->

	